package com.gpframework.module.common.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.req.BaseReq;
import com.gpframework.module.common.domain.GpCommonFeedback;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @ClassName GpCommonFeedbackReq
 * @Author gpframework
 * @Date 2021-12-09
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class GpCommonFeedbackReq extends BaseReq {
    private static final long serialVersionUID = 1L;

         @ApiModelProperty("主键")
     private Long id;
     @ApiModelProperty("会员Id")
     private Long memberId;
     @ApiModelProperty("问题描述")
     private String content;
     @ApiModelProperty("图片")
     private String image;
     @ApiModelProperty("排序")
     private Integer sort;
     @ApiModelProperty("备注")
     private String remarks;
     @ApiModelProperty("创建者")
     private String createBy;
     @ApiModelProperty("创建时间")
     private Date createTime;
     @ApiModelProperty("更新者")
     private String updateBy;
     @ApiModelProperty("更新时间")
     private Date updateTime;
     @ApiModelProperty("删除标记")
     private Integer delStatus;

    /**
    * @Description 生成查询wrapper
    * @Author greatplan@qq.com
    * @Date 2020-11-04 16:04
    * @Param [lqw]
    * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
    * @Return void
    */
    public void generatorQuery(QueryWrapper<GpCommonFeedback> lqw,boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias+"del_status",0);
        }
        if (this.getId() != null){
        lqw.eq(alias+"id" ,this.getId());
        }
        if (this.getMemberId() != null){
        lqw.eq(alias+"member_id" ,this.getMemberId());
        }
        if (StringUtils.isNotBlank(this.getContent())){
        lqw.eq(alias+"content" ,this.getContent());
        }
        if (StringUtils.isNotBlank(this.getImage())){
        lqw.eq(alias+"image" ,this.getImage());
        }
        if (this.getSort() != null){
        lqw.eq(alias+"sort" ,this.getSort());
        }
        if (StringUtils.isNotBlank(this.getRemarks())){
        lqw.eq(alias+"remarks" ,this.getRemarks());
        }
        if (StringUtils.isNotBlank(this.getCreateBy())){
        lqw.eq(alias+"create_by" ,this.getCreateBy());
        }
        if (this.getCreateTime() != null){
        lqw.eq(alias+"create_time" ,this.getCreateTime());
        }
        if (StringUtils.isNotBlank(this.getUpdateBy())){
        lqw.eq(alias+"update_by" ,this.getUpdateBy());
        }
        if (this.getUpdateTime() != null){
        lqw.eq(alias+"update_time" ,this.getUpdateTime());
        }
        if (this.getDelStatus() != null){
        lqw.eq(alias+"del_status" ,this.getDelStatus());
        }
    }
}
